
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Terraform 初步体验 · 《Terraform入门教程》</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="大可不加冰">
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-prism/prism-vsc-dark-plus.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-image-captions/image-captions.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    
    <link rel="prev" href="./" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                        <b>1.1.</b>
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2" data-path="1.Terraform初步体验.html">
            
                <a href="1.Terraform初步体验.html">
            
                    
                        <b>1.2.</b>
                    
                    Terraform 初步体验
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                        <b>1.3.</b>
                    
                    Terraform基础概念
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="2.1.Terraform基础概念——Provider.html">
            
                <a href="2.1.Terraform基础概念——Provider.html">
            
                    
                        <b>1.3.1.</b>
                    
                    Provider
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="2.2.Terraform基础概念——状态管理.html">
            
                <a href="2.2.Terraform基础概念——状态管理.html">
            
                    
                        <b>1.3.2.</b>
                    
                    状态管理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="3.Terraform代码的书写.html">
            
                <a href="3.Terraform代码的书写.html">
            
                    
                        <b>1.4.</b>
                    
                    Terraform 代码的书写
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="3.1.类型.html">
            
                <a href="3.1.类型.html">
            
                    
                        <b>1.4.1.</b>
                    
                    类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="3.2.配置语法.html">
            
                <a href="3.2.配置语法.html">
            
                    
                        <b>1.4.2.</b>
                    
                    配置语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="3.3.输入变量.html">
            
                <a href="3.3.输入变量.html">
            
                    
                        <b>1.4.3.</b>
                    
                    输入变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="3.4.输出值.html">
            
                <a href="3.4.输出值.html">
            
                    
                        <b>1.4.4.</b>
                    
                    输出值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="3.5.局部值.html">
            
                <a href="3.5.局部值.html">
            
                    
                        <b>1.4.5.</b>
                    
                    局部值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="3.6.资源.html">
            
                <a href="3.6.资源.html">
            
                    
                        <b>1.4.6.</b>
                    
                    资源
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="3.7.数据源.html">
            
                <a href="3.7.数据源.html">
            
                    
                        <b>1.4.7.</b>
                    
                    数据源
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="3.8.表达式.html">
            
                <a href="3.8.表达式.html">
            
                    
                        <b>1.4.8.</b>
                    
                    表达式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="3.9.重载文件.html">
            
                <a href="3.9.重载文件.html">
            
                    
                        <b>1.4.9.</b>
                    
                    重载文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="3.10.代码风格规范.html">
            
                <a href="3.10.代码风格规范.html">
            
                    
                        <b>1.4.10.</b>
                    
                    代码风格规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11" data-path="3.11.checks.html">
            
                <a href="3.11.checks.html">
            
                    
                        <b>1.4.11.</b>
                    
                    Checks
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="4.Terraform模块.html">
            
                <a href="4.Terraform模块.html">
            
                    
                        <b>1.5.</b>
                    
                    Terraform 模块
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="4.1.创建模块.html">
            
                <a href="4.1.创建模块.html">
            
                    
                        <b>1.5.1.</b>
                    
                    创建模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="4.2.使用模块.html">
            
                <a href="4.2.使用模块.html">
            
                    
                        <b>1.5.2.</b>
                    
                    使用模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="4.3.模块元参数.html">
            
                <a href="4.3.模块元参数.html">
            
                    
                        <b>1.5.3.</b>
                    
                    模块元参数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="4.4.重构.html">
            
                <a href="4.4.重构.html">
            
                    
                        <b>1.5.4.</b>
                    
                    重构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="4.5.设计新模块的模式.html">
            
                <a href="4.5.设计新模块的模式.html">
            
                    
                        <b>1.5.5.</b>
                    
                    设计新模块的模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="5.Terraform命令行.html">
            
                <a href="5.Terraform命令行.html">
            
                    
                        <b>1.6.</b>
                    
                    Terraform 命令行
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="5.1.命令行配置文件.html">
            
                <a href="5.1.命令行配置文件.html">
            
                    
                        <b>1.6.1.</b>
                    
                    命令行配置文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="5.2.环境变量.html">
            
                <a href="5.2.环境变量.html">
            
                    
                        <b>1.6.2.</b>
                    
                    环境变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="5.3.资源地址.html">
            
                <a href="5.3.资源地址.html">
            
                    
                        <b>1.6.3.</b>
                    
                    资源地址
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="5.4.apply.html">
            
                <a href="5.4.apply.html">
            
                    
                        <b>1.6.4.</b>
                    
                    apply
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="5.5.console.html">
            
                <a href="5.5.console.html">
            
                    
                        <b>1.6.5.</b>
                    
                    console
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="5.6.destroy.html">
            
                <a href="5.6.destroy.html">
            
                    
                        <b>1.6.6.</b>
                    
                    destroy
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="5.7.fmt.html">
            
                <a href="5.7.fmt.html">
            
                    
                        <b>1.6.7.</b>
                    
                    fmt
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="5.8.force-unlock.html">
            
                <a href="5.8.force-unlock.html">
            
                    
                        <b>1.6.8.</b>
                    
                    force-unlock
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="5.9.get.html">
            
                <a href="5.9.get.html">
            
                    
                        <b>1.6.9.</b>
                    
                    get
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10" data-path="5.10.graph.html">
            
                <a href="5.10.graph.html">
            
                    
                        <b>1.6.10.</b>
                    
                    graph
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.11" data-path="5.11.import.html">
            
                <a href="5.11.import.html">
            
                    
                        <b>1.6.11.</b>
                    
                    import
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.12" data-path="5.12.init.html">
            
                <a href="5.12.init.html">
            
                    
                        <b>1.6.12.</b>
                    
                    init
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.13" data-path="5.13.output.html">
            
                <a href="5.13.output.html">
            
                    
                        <b>1.6.13.</b>
                    
                    output
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.14" data-path="5.14.plan.html">
            
                <a href="5.14.plan.html">
            
                    
                        <b>1.6.14.</b>
                    
                    plan
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.15" data-path="5.15.providers.html">
            
                <a href="5.15.providers.html">
            
                    
                        <b>1.6.15.</b>
                    
                    providers
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.15.1" data-path="5.15.1.mirror.html">
            
                <a href="5.15.1.mirror.html">
            
                    
                        <b>1.6.15.1.</b>
                    
                    mirror
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.15.2" data-path="5.15.2.schema.html">
            
                <a href="5.15.2.schema.html">
            
                    
                        <b>1.6.15.2.</b>
                    
                    schema
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.16" data-path="5.16.refresh.html">
            
                <a href="5.16.refresh.html">
            
                    
                        <b>1.6.16.</b>
                    
                    refresh
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.17" data-path="5.17.show.html">
            
                <a href="5.17.show.html">
            
                    
                        <b>1.6.17.</b>
                    
                    show
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.18" data-path="5.18.state.html">
            
                <a href="5.18.state.html">
            
                    
                        <b>1.6.18.</b>
                    
                    state
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.18.1" data-path="5.18.1.list.html">
            
                <a href="5.18.1.list.html">
            
                    
                        <b>1.6.18.1.</b>
                    
                    list
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.18.2" data-path="5.18.2.mv.html">
            
                <a href="5.18.2.mv.html">
            
                    
                        <b>1.6.18.2.</b>
                    
                    mv
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.18.3" data-path="5.18.3.pull.html">
            
                <a href="5.18.3.pull.html">
            
                    
                        <b>1.6.18.3.</b>
                    
                    pull
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.18.4" data-path="5.18.4.push.html">
            
                <a href="5.18.4.push.html">
            
                    
                        <b>1.6.18.4.</b>
                    
                    push
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.18.5" data-path="5.18.5.replace-provider.html">
            
                <a href="5.18.5.replace-provider.html">
            
                    
                        <b>1.6.18.5.</b>
                    
                    replace-provider
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.18.6" data-path="5.18.6.rm.html">
            
                <a href="5.18.6.rm.html">
            
                    
                        <b>1.6.18.6.</b>
                    
                    rm
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.18.7" data-path="5.18.7.show.html">
            
                <a href="5.18.7.show.html">
            
                    
                        <b>1.6.18.7.</b>
                    
                    show
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.19" data-path="5.19.taint.html">
            
                <a href="5.19.taint.html">
            
                    
                        <b>1.6.19.</b>
                    
                    taint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.20" data-path="5.20.validate.html">
            
                <a href="5.20.validate.html">
            
                    
                        <b>1.6.20.</b>
                    
                    validate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.21" data-path="5.21.untaint.html">
            
                <a href="5.21.untaint.html">
            
                    
                        <b>1.6.21.</b>
                    
                    untaint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.22" data-path="5.22.workspace.html">
            
                <a href="5.22.workspace.html">
            
                    
                        <b>1.6.22.</b>
                    
                    workspace
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.22.1" data-path="5.22.1.list.html">
            
                <a href="5.22.1.list.html">
            
                    
                        <b>1.6.22.1.</b>
                    
                    list
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.22.2" data-path="5.22.2.select.html">
            
                <a href="5.22.2.select.html">
            
                    
                        <b>1.6.22.2.</b>
                    
                    select
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.22.3" data-path="5.22.3.new.html">
            
                <a href="5.22.3.new.html">
            
                    
                        <b>1.6.22.3.</b>
                    
                    new
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.22.4" data-path="5.22.4.delete.html">
            
                <a href="5.22.4.delete.html">
            
                    
                        <b>1.6.22.4.</b>
                    
                    delete
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.22.5" data-path="5.22.5.show.html">
            
                <a href="5.22.5.show.html">
            
                    
                        <b>1.6.22.5.</b>
                    
                    show
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="6.test.html">
            
                <a href="6.test.html">
            
                    
                        <b>1.7.</b>
                    
                    Terraform Test
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="7.Aha——会心一击.html">
            
                <a href="7.Aha——会心一击.html">
            
                    
                        <b>1.8.</b>
                    
                    Aha——会心一击
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="7.1.有条件创建.html">
            
                <a href="7.1.有条件创建.html">
            
                    
                        <b>1.8.1.</b>
                    
                    有条件创建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="7.2.依赖反转.html">
            
                <a href="7.2.依赖反转.html">
            
                    
                        <b>1.8.2.</b>
                    
                    依赖反转
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="7.3.多可用区分布.html">
            
                <a href="7.3.多可用区分布.html">
            
                    
                        <b>1.8.3.</b>
                    
                    多可用区分布
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="7.4.provisioner与user_data.html">
            
                <a href="7.4.provisioner与user_data.html">
            
                    
                        <b>1.8.4.</b>
                    
                    provisioner与user_data
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="7.5.destroy-provisioner中使用变量.html">
            
                <a href="7.5.destroy-provisioner中使用变量.html">
            
                    
                        <b>1.8.5.</b>
                    
                    destroy-provisioner中使用变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.6" data-path="7.6.利用null_resource的triggers触发其他资源更新.html">
            
                <a href="7.6.利用null_resource的triggers触发其他资源更新.html">
            
                    
                        <b>1.8.6.</b>
                    
                    利用null_resource的triggers触发其他资源更新
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.7" data-path="7.7.利用null_resource搭配replace_triggered_by更新无法读取的属性.html">
            
                <a href="7.7.利用null_resource搭配replace_triggered_by更新无法读取的属性.html">
            
                    
                        <b>1.8.7.</b>
                    
                    利用 null_resource 搭配 replace_triggered_by 更新无法从服务端读取内容的属性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.8" data-path="7.8.创建资源的条件依赖另一个资源的输出时怎么办.html">
            
                <a href="7.8.创建资源的条件依赖另一个资源的输出时怎么办.html">
            
                    
                        <b>1.8.8.</b>
                    
                    创建资源的条件依赖另一个资源的输出时怎么办
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.9" data-path="7.9.利用create_before_destroy调整资源update执行的顺序.html">
            
                <a href="7.9.利用create_before_destroy调整资源update执行的顺序.html">
            
                    
                        <b>1.8.9.</b>
                    
                    利用 create_before_destroy 调整资源 Update 的执行顺序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.10" data-path="7.10.terraform与自动化.html">
            
                <a href="7.10.terraform与自动化.html">
            
                    
                        <b>1.8.10.</b>
                    
                    Terraform 与自动化
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="8.CloudPosse最佳实践.html">
            
                <a href="8.CloudPosse最佳实践.html">
            
                    
                        <b>1.9.</b>
                    
                    来自CloudPosse的Terraform最佳实践
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="9.后记.html">
            
                <a href="9.后记.html">
            
                    
                        <b>1.10.</b>
                    
                    后记
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >Terraform 初步体验</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#terraform&#x521D;&#x6B65;&#x4F53;&#x9A8C;"><b>1.2.1. </b>Terraform&#x521D;&#x6B65;&#x4F53;&#x9A8C;</a></li><ul><li><span class="title-icon "></span><a href="#&#x5B89;&#x88C5;"><b>1.2.1.1. </b>&#x5B89;&#x88C5;</a></li><li><span class="title-icon "></span><a href="#&#x9A8C;&#x8BC1;"><b>1.2.1.2. </b>&#x9A8C;&#x8BC1;</a></li><li><span class="title-icon "></span><a href="#&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;&#x4F8B;&#x5B50;"><b>1.2.1.3. </b>&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;&#x4F8B;&#x5B50;</a></li><li><span class="title-icon "></span><a href="#&#x6E05;&#x7406;"><b>1.2.1.4. </b>&#x6E05;&#x7406;</a></li></ul></ul></div><a href="#terraform&#x521D;&#x6B65;&#x4F53;&#x9A8C;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="terraform&#x521D;&#x6B65;&#x4F53;&#x9A8C;"><a name="terraform&#x521D;&#x6B65;&#x4F53;&#x9A8C;" class="anchor-navigation-ex-anchor" href="#terraform&#x521D;&#x6B65;&#x4F53;&#x9A8C;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2.1. Terraform&#x521D;&#x6B65;&#x4F53;&#x9A8C;</h1>
<h2 id="&#x5B89;&#x88C5;"><a name="&#x5B89;&#x88C5;" class="anchor-navigation-ex-anchor" href="#&#x5B89;&#x88C5;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2.1.1. &#x5B89;&#x88C5;</h2>
<p>&#x9996;&#x5148;&#x6211;&#x4EEC;&#x5148;&#x5B89;&#x88C5;Terraform&#x3002;&#x5BF9;&#x4E8E;Ubuntu&#x7528;&#x6237;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash"><span class="token function">sudo</span> <span class="token function">apt-get</span> update <span class="token operator">&amp;&amp;</span> <span class="token function">sudo</span> <span class="token function">apt-get</span> <span class="token function">install</span> <span class="token parameter variable">-y</span> <span class="token function">wget</span> <span class="token function">curl</span> gnupg software-properties-common
<span class="token function">wget</span> -O- https://apt.releases.hashicorp.com/gpg <span class="token operator">|</span> <span class="token punctuation">\</span>
gpg <span class="token parameter variable">--dearmor</span> <span class="token operator">|</span> <span class="token punctuation">\</span>
<span class="token function">sudo</span> <span class="token function">tee</span> /usr/share/keyrings/hashicorp-archive-keyring.gpg
<span class="token builtin class-name">echo</span> <span class="token string">&quot;deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \
https://apt.releases.hashicorp.com <span class="token variable"><span class="token variable">$(</span>lsb_release <span class="token parameter variable">-cs</span><span class="token variable">)</span></span> main&quot;</span> <span class="token operator">|</span> <span class="token punctuation">\</span>
<span class="token function">sudo</span> <span class="token function">tee</span> /etc/apt/sources.list.d/hashicorp.list
<span class="token function">sudo</span> <span class="token function">apt</span> update
<span class="token function">sudo</span> <span class="token function">apt-get</span> <span class="token function">install</span> terraform
</code></pre>
<p>&#x5BF9;&#x4E8E;CentOS&#x7528;&#x6237;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash"><span class="token function">sudo</span> yum <span class="token function">install</span> <span class="token parameter variable">-y</span> yum-utils
<span class="token function">sudo</span> yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
<span class="token function">sudo</span> yum <span class="token parameter variable">-y</span> <span class="token function">install</span> terraform
</code></pre>
<p>&#x5BF9;&#x4E8E;Mac&#x7528;&#x6237;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">brew tap hashicorp/tap
brew <span class="token function">install</span> hashicorp/tap/terraform
</code></pre>
<p>&#x5BF9;&#x4E8E;Windows&#x7528;&#x6237;&#xFF0C;&#x5B98;&#x65B9;&#x63A8;&#x8350;&#x7684;&#x5305;&#x7BA1;&#x7406;&#x5668;&#x662F;choco&#xFF0C;&#x53EF;&#x4EE5;&#x53BB;<a href="https://chocolatey.org/" target="_blank">https://chocolatey.org/</a> &#x4E0B;&#x8F7D;&#x5B89;&#x88C5;&#x597D;chocolatey&#x540E;&#xFF0C;&#x4EE5;&#x7BA1;&#x7406;&#x5458;&#x8EAB;&#x4EFD;&#x542F;&#x52A8;powershell&#xFF0C;&#x7136;&#x540E;&#xFF1A;</p>
<pre class="language-"><code class="lang-powershell">choco install terraform
</code></pre>
<p>&#x5982;&#x679C;&#x53EA;&#x60F3;&#x7EAF;&#x624B;&#x52A8;&#x5B89;&#x88C5;&#xFF0C;&#x90A3;&#x4E48;&#x53EF;&#x4EE5;&#x524D;&#x5F80;Terraform&#x5B98;&#x7F51;&#x4E0B;&#x8F7D;&#x5BF9;&#x5E94;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x7684;&#x53EF;&#x6267;&#x884C;&#x6587;&#x4EF6;(Terraform&#x662F;&#x7528;go&#x7F16;&#x5199;&#x7684;&#xFF0C;&#x53EA;&#x6709;&#x4E00;&#x4E2A;&#x53EF;&#x6267;&#x884C;&#x6587;&#x4EF6;)&#xFF0C;&#x89E3;&#x538B;&#x7F29;&#x5230;&#x6307;&#x5B9A;&#x7684;&#x4F4D;&#x7F6E;&#x540E;&#xFF0C;&#x914D;&#x7F6E;&#x4E00;&#x4E0B;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x7684;PATH&#xFF0C;&#x4F7F;&#x5176;&#x5305;&#x542B;Terraform&#x6240;&#x5728;&#x7684;&#x76EE;&#x5F55;&#x5373;&#x53EF;&#x3002;</p>
<h2 id="&#x9A8C;&#x8BC1;"><a name="&#x9A8C;&#x8BC1;" class="anchor-navigation-ex-anchor" href="#&#x9A8C;&#x8BC1;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2.1.2. &#x9A8C;&#x8BC1;</h2>
<pre class="language-"><code class="lang-bash">terraform version
Terraform v1.7.3

terraform <span class="token parameter variable">-h</span>
Usage: terraform <span class="token punctuation">[</span>global options<span class="token punctuation">]</span> <span class="token operator">&lt;</span>subcommand<span class="token operator">&gt;</span> <span class="token punctuation">[</span>args<span class="token punctuation">]</span>

The available commands <span class="token keyword">for</span> execution are listed below.
The primary workflow commands are given first, followed by
<span class="token function">less</span> common or <span class="token function">more</span> advanced commands.

Main commands:
  init          Prepare your working directory <span class="token keyword">for</span> other commands
  validate      Check whether the configuration is valid
  plan          Show changes required by the current configuration
  apply         Create or update infrastructure
  destroy       Destroy previously-created infrastructure

All other commands:
  console       Try Terraform expressions at an interactive <span class="token builtin class-name">command</span> prompt
  <span class="token function">fmt</span>           Reformat your configuration <span class="token keyword">in</span> the standard style
  force-unlock  Release a stuck lock on the current workspace
  get           Install or upgrade remote Terraform modules
  graph         Generate a Graphviz graph of the steps <span class="token keyword">in</span> an operation
  <span class="token function">import</span>        Associate existing infrastructure with a Terraform resource
  login         Obtain and save credentials <span class="token keyword">for</span> a remote <span class="token function">host</span>
  <span class="token builtin class-name">logout</span>        Remove locally-stored credentials <span class="token keyword">for</span> a remote <span class="token function">host</span>
  metadata      Metadata related commands
  output        Show output values from your root module
  providers     Show the providers required <span class="token keyword">for</span> this configuration
  refresh       Update the state to match remote systems
  show          Show the current state or a saved plan
  state         Advanced state management
  taint         Mark a resource instance as not fully functional
  <span class="token builtin class-name">test</span>          Execute integration tests <span class="token keyword">for</span> Terraform modules
  untaint       Remove the <span class="token string">&apos;tainted&apos;</span> state from a resource instance
  version       Show the current Terraform version
  workspace     Workspace management

Global options <span class="token punctuation">(</span>use these before the subcommand, <span class="token keyword">if</span> any<span class="token punctuation">)</span>:
  <span class="token parameter variable">-chdir</span><span class="token operator">=</span>DIR    Switch to a different working directory before executing the
                given subcommand.
  <span class="token parameter variable">-help</span>         Show this <span class="token builtin class-name">help</span> output, or the <span class="token builtin class-name">help</span> <span class="token keyword">for</span> a specified subcommand.
  <span class="token parameter variable">-version</span>      An <span class="token builtin class-name">alias</span> <span class="token keyword">for</span> the <span class="token string">&quot;version&quot;</span> subcommand.
</code></pre>
<h2 id="&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;&#x4F8B;&#x5B50;"><a name="&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;&#x4F8B;&#x5B50;" class="anchor-navigation-ex-anchor" href="#&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;&#x4F8B;&#x5B50;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2.1.3. &#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;&#x4F8B;&#x5B50;</h2>
<p>&#x4E3A;&#x4E86;&#x7ED9;&#x8BFB;&#x8005;&#x4E00;&#x4E2A;&#x5B89;&#x5168;&#x7684;&#x4F53;&#x9A8C;&#x73AF;&#x5883;&#xFF0C;&#x907F;&#x514D;&#x4ED8;&#x8D39;&#xFF0C;&#x6211;&#x4EEC;&#x4E0B;&#x9762;&#x4F7F;&#x7528; <a href="https://www.localstack.cloud/" target="_blank">LocalStack</a> &#x642D;&#x914D; Terraform &#x6765;&#x521B;&#x5EFA;&#x4E00;&#x6279;&#x865A;&#x62DF;&#x7684;&#x4E91;&#x8D44;&#x6E90;&#x3002;</p>
<p>&#x542F;&#x52A8; LocalStack &#x6700;&#x7B80;&#x5355;&#x7684;&#x65B9;&#x6CD5;&#x662F;&#x4F7F;&#x7528; <a href="https://www.docker.com/" target="_blank">Docker</a>&#xFF1A;</p>
<pre class="language-"><code class="lang-shell"><span class="token function">docker</span> run <span class="token punctuation">\</span>
  <span class="token parameter variable">--rm</span> <span class="token parameter variable">-it</span> <span class="token punctuation">\</span>
  <span class="token parameter variable">-p</span> <span class="token number">4566</span>:4566 <span class="token punctuation">\</span>
  <span class="token parameter variable">-p</span> <span class="token number">4510</span>-4559:4510-4559 <span class="token punctuation">\</span>
  localstack/localstack
</code></pre>
<p>&#x770B;&#x5230;&#x5982;&#x4E0B;&#x8F93;&#x51FA;&#x65F6;&#x8BF4;&#x660E; LocalStack &#x5DF2;&#x7ECF;&#x51C6;&#x5907;&#x597D;&#x4E86;&#xFF1A;</p>
<pre class="language-"><code class="lang-shell"><span class="token punctuation">..</span>.

LocalStack version: <span class="token number">3.1</span>.1.dev
LocalStack build date: <span class="token number">2024</span>-02-14
LocalStack build <span class="token function">git</span> hash: ebaf4ea8d

<span class="token number">2024</span>-02-15T01:56:11.845  INFO --- <span class="token punctuation">[</span>-functhread4<span class="token punctuation">]</span> hypercorn.error            <span class="token builtin class-name">:</span> Running on https://0.0.0.0:4566 <span class="token punctuation">(</span>CTRL + C to quit<span class="token punctuation">)</span>
<span class="token number">2024</span>-02-15T01:56:11.845  INFO --- <span class="token punctuation">[</span>-functhread4<span class="token punctuation">]</span> hypercorn.error            <span class="token builtin class-name">:</span> Running on https://0.0.0.0:4566 <span class="token punctuation">(</span>CTRL + C to quit<span class="token punctuation">)</span>
<span class="token number">2024</span>-02-15T01:56:12.103  INFO --- <span class="token punctuation">[</span>  MainThread<span class="token punctuation">]</span> localstack.utils.bootstrap <span class="token builtin class-name">:</span> Execution of <span class="token string">&quot;start_runtime_components&quot;</span> took <span class="token number">1804</span>.56ms
Ready.
</code></pre>
<p>&#x7136;&#x540E;&#x6211;&#x4EEC;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x5E72;&#x51C0;&#x7684;&#x7A7A;&#x6587;&#x4EF6;&#x5939;&#xFF0C;&#x5728;&#x91CC;&#x9762;&#x521B;&#x5EFA;&#x4E00;&#x4E2A; <code>main.tf</code> &#x6587;&#x4EF6;(<code>.tf</code> &#x5C31;&#x662F; <code>Terraform</code>&#xFF0C;<code>Terraform</code> &#x4EE3;&#x7801;&#x5927;&#x90E8;&#x5206;&#x662F; <code>.tf</code> &#x6587;&#x4EF6;&#xFF0C;&#x8BED;&#x6CD5;&#x662F; HCL&#xFF0C;&#x5F53;&#x7136;&#x76EE;&#x524D;&#x4E5F;&#x652F;&#x6301; JSON &#x683C;&#x5F0F;&#x7684; Terraform &#x4EE3;&#x7801;&#xFF0C;&#x4F46;&#x6211;&#x4EEC;&#x6682;&#x65F6;&#x53EA;&#x4EE5; <code>.tf</code> &#x4E3A;&#x4F8B;)&#xFF1A;</p>
<pre class="language-"><code class="lang-hcl"><span class="token keyword">terraform</span> <span class="token punctuation">{</span>
  <span class="token keyword">required_providers</span> <span class="token punctuation">{</span>
    <span class="token property">aws</span> <span class="token punctuation">=</span> <span class="token punctuation">{</span>
      <span class="token property">source</span> <span class="token punctuation">=</span> <span class="token string">&quot;hashicorp/aws&quot;</span>
      <span class="token property">version</span> <span class="token punctuation">=</span> <span class="token string">&quot;~&gt;5.0&quot;</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>

<span class="token keyword">provider<span class="token type variable"> &quot;aws&quot; </span></span><span class="token punctuation">{</span>
  <span class="token property">access_key</span>                  <span class="token punctuation">=</span> <span class="token string">&quot;test&quot;</span>
  <span class="token property">secret_key</span>                  <span class="token punctuation">=</span> <span class="token string">&quot;test&quot;</span>
  <span class="token property">region</span>                      <span class="token punctuation">=</span> <span class="token string">&quot;us-east-1&quot;</span>
  <span class="token property">s3_use_path_style</span>           <span class="token punctuation">=</span> <span class="token boolean">false</span>
  <span class="token property">skip_credentials_validation</span> <span class="token punctuation">=</span> <span class="token boolean">true</span>
  <span class="token property">skip_metadata_api_check</span>     <span class="token punctuation">=</span> <span class="token boolean">true</span>
  <span class="token property">skip_requesting_account_id</span>  <span class="token punctuation">=</span> <span class="token boolean">true</span>

  <span class="token keyword">endpoints</span> <span class="token punctuation">{</span>
    <span class="token property">apigateway</span>     <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">apigatewayv2</span>   <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">cloudformation</span> <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">cloudwatch</span>     <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">dynamodb</span>       <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">ec2</span>            <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">es</span>             <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">elasticache</span>    <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">firehose</span>       <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">iam</span>            <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">kinesis</span>        <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">lambda</span>         <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">rds</span>            <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">redshift</span>       <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">route53</span>        <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">s3</span>             <span class="token punctuation">=</span> <span class="token string">&quot;http://s3.localhost.localstack.cloud:4566&quot;</span>
    <span class="token property">secretsmanager</span> <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">ses</span>            <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">sns</span>            <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">sqs</span>            <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">ssm</span>            <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">stepfunctions</span>  <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">sts</span>            <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>

<span class="token keyword">data <span class="token type variable">&quot;aws_ami&quot;</span></span> <span class="token string">&quot;ubuntu&quot;</span> <span class="token punctuation">{</span>
  <span class="token property">most_recent</span> <span class="token punctuation">=</span> <span class="token boolean">true</span>

  <span class="token keyword">filter</span> <span class="token punctuation">{</span>
    <span class="token property">name</span>   <span class="token punctuation">=</span> <span class="token string">&quot;name&quot;</span>
    <span class="token property">values</span> <span class="token punctuation">=</span> <span class="token punctuation">[</span><span class="token string">&quot;ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-20170727&quot;</span><span class="token punctuation">]</span>
  <span class="token punctuation">}</span>

  <span class="token keyword">filter</span> <span class="token punctuation">{</span>
    <span class="token property">name</span>   <span class="token punctuation">=</span> <span class="token string">&quot;virtualization-type&quot;</span>
    <span class="token property">values</span> <span class="token punctuation">=</span> <span class="token punctuation">[</span><span class="token string">&quot;hvm&quot;</span><span class="token punctuation">]</span>
  <span class="token punctuation">}</span>

  <span class="token property">owners</span> <span class="token punctuation">=</span> <span class="token punctuation">[</span><span class="token string">&quot;099720109477&quot;</span><span class="token punctuation">]</span> <span class="token comment"># Canonical</span>
<span class="token punctuation">}</span>

<span class="token keyword">resource <span class="token type variable">&quot;aws_instance&quot;</span></span> <span class="token string">&quot;web&quot;</span> <span class="token punctuation">{</span>
  <span class="token property">ami</span>           <span class="token punctuation">=</span> data.aws_ami.ubuntu.id
  <span class="token property">instance_type</span> <span class="token punctuation">=</span> <span class="token string">&quot;t3.micro&quot;</span>

  <span class="token property">tags</span> <span class="token punctuation">=</span> <span class="token punctuation">{</span>
    <span class="token property">Name</span> <span class="token punctuation">=</span> <span class="token string">&quot;HelloWorld&quot;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>

<span class="token keyword">resource <span class="token type variable">&quot;aws_eip_association&quot;</span></span> <span class="token string">&quot;eip_assoc&quot;</span> <span class="token punctuation">{</span>
  <span class="token property">instance_id</span>   <span class="token punctuation">=</span> aws_instance.web.id
  <span class="token property">allocation_id</span> <span class="token punctuation">=</span> aws_eip.example.id
<span class="token punctuation">}</span>

<span class="token keyword">resource <span class="token type variable">&quot;aws_eip&quot;</span></span> <span class="token string">&quot;example&quot;</span> <span class="token punctuation">{</span>
  <span class="token property">domain</span> <span class="token punctuation">=</span> <span class="token string">&quot;vpc&quot;</span>
<span class="token punctuation">}</span>

<span class="token keyword">output<span class="token type variable"> &quot;instance_id&quot; </span></span><span class="token punctuation">{</span>
  <span class="token property">value</span> <span class="token punctuation">=</span> aws_instance.web.id
<span class="token punctuation">}</span>
</code></pre>
<p>&#x8FD9;&#x91CC;&#x8981;&#x6CE8;&#x610F;&#x4EE3;&#x7801;&#x4E2D;&#x7684;&#x8FD9;&#x4E00;&#x6BB5;&#xFF1A;</p>
<pre class="language-"><code class="lang-hcl"><span class="token keyword">provider<span class="token type variable"> &quot;aws&quot; </span></span><span class="token punctuation">{</span>
  <span class="token property">access_key</span>                  <span class="token punctuation">=</span> <span class="token string">&quot;test&quot;</span>
  <span class="token property">secret_key</span>                  <span class="token punctuation">=</span> <span class="token string">&quot;test&quot;</span>
  <span class="token property">region</span>                      <span class="token punctuation">=</span> <span class="token string">&quot;us-east-1&quot;</span>
  <span class="token property">s3_use_path_style</span>           <span class="token punctuation">=</span> <span class="token boolean">false</span>
  <span class="token property">skip_credentials_validation</span> <span class="token punctuation">=</span> <span class="token boolean">true</span>
  <span class="token property">skip_metadata_api_check</span>     <span class="token punctuation">=</span> <span class="token boolean">true</span>
  <span class="token property">skip_requesting_account_id</span>  <span class="token punctuation">=</span> <span class="token boolean">true</span>

  <span class="token keyword">endpoints</span> <span class="token punctuation">{</span>
    <span class="token property">apigateway</span>     <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">apigatewayv2</span>   <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">cloudformation</span> <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">cloudwatch</span>     <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">dynamodb</span>       <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">ec2</span>            <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">es</span>             <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">elasticache</span>    <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">firehose</span>       <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">iam</span>            <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">kinesis</span>        <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">lambda</span>         <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">rds</span>            <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">redshift</span>       <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">route53</span>        <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">s3</span>             <span class="token punctuation">=</span> <span class="token string">&quot;http://s3.localhost.localstack.cloud:4566&quot;</span>
    <span class="token property">secretsmanager</span> <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">ses</span>            <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">sns</span>            <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">sqs</span>            <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">ssm</span>            <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">stepfunctions</span>  <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
    <span class="token property">sts</span>            <span class="token punctuation">=</span> <span class="token string">&quot;http://localhost:4566&quot;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x56E0;&#x4E3A;&#x6211;&#x4EEC;&#x4F7F;&#x7528;&#x7684;&#x662F;&#x901A;&#x8FC7; LocalStack &#x6A21;&#x62DF;&#x7684;&#x865A;&#x62DF; AWS &#x670D;&#x52A1;&#xFF0C;&#x6240;&#x4EE5;&#x5728;&#x8FD9;&#x91CC;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5728; <code>endpoints</code> &#x4E2D;&#x628A;&#x5404;&#x4E2A;&#x670D;&#x52A1; API &#x7684;&#x7AEF;&#x70B9;&#x8BBE;&#x7F6E;&#x4E3A; LocalStack &#x66B4;&#x9732;&#x7684;&#x672C;&#x5730;&#x7AEF;&#x70B9;&#x3002;&#x539F;&#x672C;&#x7684; <code>access_key</code> &#x548C; <code>secret_key</code> &#x5E94;&#x8BE5;&#x662F;&#x901A;&#x8FC7; <a href="https://aws.amazon.com/iam/" target="_blank">AWS IAM</a> &#x83B7;&#x53D6;&#x7684;&#xFF0C;&#x5728;&#x8FD9;&#x91CC;&#x6211;&#x4EEC;&#x5C31;&#x53EF;&#x4EE5;&#x7528;&#x5047;&#x7684; Key &#x6765;&#x66FF;&#x4EE3;&#x3002;</p>
<p>&#x8FD9;&#x6BB5;&#x4EE3;&#x7801;&#x6BD4;&#x8F83;&#x7B80;&#x5355;&#xFF0C;&#x5934;&#x90E8;&#x7684;<code>terraform</code>&#x8FD9;&#x4E00;&#x6BB5;&#x58F0;&#x660E;&#x4E86;&#x8FD9;&#x6BB5;&#x4EE3;&#x7801;&#x6240;&#x9700;&#x8981;&#x7684;Terraform&#x7248;&#x672C;&#x4EE5;&#x53CA; AWS &#x63D2;&#x4EF6;&#x7248;&#x672C;&#xFF0C;&#x540E;&#x9762;&#x7684; <code>provider</code> &#x6BB5;&#x5219;&#x662F;&#x7ED9;&#x51FA;&#x4E86;&#x8C03;&#x7528; AWS API&#x6240;&#x9700;&#x8981;&#x7684; key &#x548C; <code>region</code> &#x7B49;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x771F;&#x6B63;&#x5B9A;&#x4E49;&#x4E91;&#x7AEF;&#x57FA;&#x7840;&#x8BBE;&#x65BD;&#x7684;&#x4EE3;&#x7801;&#x5C31;&#x662F;&#x540E;&#x9762;&#x7684;&#x90E8;&#x5206;&#xFF0C;&#x5206;&#x4E3A;&#x4E09;&#x90E8;&#x5206;&#xFF0C;<code>data</code>&#x3001;<code>resource</code> &#x548C; <code>output</code>&#x3002;</p>
<p><code>data</code> &#x4EE3;&#x8868;&#x5229;&#x7528; AWS &#x63D2;&#x4EF6;&#x5B9A;&#x4E49;&#x7684; <code>data</code> &#x6A21;&#x578B;&#x5BF9; AWS &#x8FDB;&#x884C;&#x67E5;&#x8BE2;&#xFF0C;&#x4F8B;&#x5982;&#x6211;&#x4EEC;&#x5728;&#x4EE3;&#x7801;&#x4E2D;&#x5229;&#x7528; <code>data</code> &#x67E5;&#x8BE2;&#x540D;&#x4E3A; <code>&quot;ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-20170727</code> &#x7684; AWS &#x865A;&#x62DF;&#x673A;&#x955C;&#x50CF; ID&#xFF0C;&#x8FD9;&#x6837;&#x6211;&#x4EEC;&#x5C31;&#x4E0D;&#x9700;&#x8981;&#x4EBA;&#x5DE5;&#x5728;&#x754C;&#x9762;&#x4E0A;&#x53BB;&#x67E5;&#x8BE2;&#x76F8;&#x5173; ID&#xFF0C;&#x518D;&#x786C;&#x7F16;&#x7801;&#x5230;&#x4EE3;&#x7801;&#x4E2D;&#x3002;&#x8BF7;&#x6CE8;&#x610F;&#xFF0C;&#x7531;&#x4E8E;&#x6211;&#x4EEC;&#x4F7F;&#x7528;&#x7684;&#x662F; LocalStack &#x865A;&#x62DF;&#x7684; AWS&#xFF0C;&#x6240;&#x4EE5;&#x8FD9;&#x91CC;&#x7684; <code>name</code> &#x548C; <code>owners</code> &#x90FD;&#x662F;&#x53C2;&#x7167;&#x4E86; LocalStack &#x81EA;&#x5E26;&#x7684;<a href="https://github.com/localstack/moto/blob/f7ab328e4ab0347ec7a82f58a1dec584a8522ba7/moto/ec2/resources/amis.json" target="_blank">&#x6A21;&#x62DF;&#x6570;&#x636E;</a> &#x6784;&#x9020;&#x7684;&#x3002;</p>
<p><code>resource</code> &#x4EE3;&#x8868;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5728;&#x4E91;&#x7AEF;&#x521B;&#x5EFA;&#x7684;&#x8D44;&#x6E90;&#xFF0C;&#x5728;&#x4F8B;&#x5B50;&#x91CC;&#x6211;&#x4EEC;&#x521B;&#x5EFA;&#x4E86;&#x4E09;&#x4E2A;&#x8D44;&#x6E90;&#xFF0C;&#x5206;&#x522B;&#x662F;&#x4E3B;&#x673A;&#x3001;&#x5F39;&#x6027;&#x516C;&#x7F51; ip&#xFF0C;&#x4EE5;&#x53CA;&#x4E3B;&#x673A;&#x548C;&#x516C;&#x7F51; ip &#x7684;&#x7ED1;&#x5B9A;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x5728;&#x5B9A;&#x4E49;&#x4E3B;&#x673A;&#x65F6;&#x7ED9;&#x5B9A;&#x4E86;&#x4E3B;&#x673A;&#x7684;&#x5C3A;&#x5BF8;&#x540D;&#x79F0;&#x7B49;&#x5173;&#x952E;&#x4FE1;&#x606F;&#xFF0C;&#x6700;&#x540E;&#xFF0C;&#x6211;&#x4EEC;&#x58F0;&#x660E;&#x4E86;&#x4E00;&#x4E2A;output&#xFF0C;&#x540D;&#x5B57;&#x662F;<code>eip</code>&#xFF0C;&#x5B83;&#x7684;&#x503C;&#x5C31;&#x662F;&#x6211;&#x4EEC;&#x521B;&#x5EFA;&#x7684;&#x5F39;&#x6027;&#x516C;&#x7F51;ip&#x7684;&#x503C;&#x3002;</p>
<p>&#x8FD0;&#x884C;&#x8FD9;&#x6BB5;&#x4EE3;&#x7801;&#x5F88;&#x7B80;&#x5355;&#xFF0C;&#x8BA9;&#x6211;&#x4EEC;&#x5728;&#x4EE3;&#x7801;&#x6240;&#x5728;&#x7684;&#x8DEF;&#x5F84;&#x4E0B;&#x8FDB;&#x5165;&#x547D;&#x4EE4;&#x884C;&#xFF0C;&#x6267;&#x884C;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">$ terraform init
</code></pre>
<p>&#x8FD9;&#x65F6;Terraform&#x4F1A;&#x8FDB;&#x884C;&#x521D;&#x59CB;&#x5316;&#x64CD;&#x4F5C;&#xFF0C;&#x901A;&#x8FC7;&#x5B98;&#x65B9;&#x63D2;&#x4EF6;&#x4ED3;&#x5E93;&#x4E0B;&#x8F7D;&#x5BF9;&#x5E94;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x7684;UCloud&#x63D2;&#x4EF6;&#x3002;&#x5982;&#x679C;&#x4E00;&#x5207;&#x90FD;&#x6B63;&#x5E38;&#xFF0C;&#x8BFB;&#x8005;&#x5E94;&#x8BE5;&#x4F1A;&#x770B;&#x5230;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">Initializing the backend<span class="token punctuation">..</span>.

Initializing provider plugins<span class="token punctuation">..</span>.
- Finding latest version of hashicorp/aws<span class="token punctuation">..</span>.
- Installing hashicorp/aws v5.36.0<span class="token punctuation">..</span>.
- Installed hashicorp/aws v5.36.0 <span class="token punctuation">(</span>signed by HashiCorp<span class="token punctuation">)</span>

Terraform has created a lock <span class="token function">file</span> .terraform.lock.hcl to record the provider
selections it made above. Include this <span class="token function">file</span> <span class="token keyword">in</span> your version control repository
so that Terraform can guarantee to <span class="token function">make</span> the same selections by default when
you run <span class="token string">&quot;terraform init&quot;</span> <span class="token keyword">in</span> the future.

&#x2577;
&#x2502; Warning: Provider development overrides are <span class="token keyword">in</span> effect
&#x2502;
&#x2502; The following provider development overrides are <span class="token builtin class-name">set</span> <span class="token keyword">in</span> the CLI configuration:
&#x2502;  - azure/modtm <span class="token keyword">in</span> C:<span class="token punctuation">\</span>Users<span class="token punctuation">\</span>hezijie<span class="token punctuation">\</span>go<span class="token punctuation">\</span>bin
&#x2502;  - lonegunmanb/aztfteam <span class="token keyword">in</span> C:<span class="token punctuation">\</span>Users<span class="token punctuation">\</span>hezijie<span class="token punctuation">\</span>go<span class="token punctuation">\</span>bin
&#x2502;
&#x2502; Skip terraform init when using provider development overrides. It is not necessary and may error unexpectedly.
&#x2575;

Terraform has been successfully initialized<span class="token operator">!</span>

You may now begin working with Terraform. Try running <span class="token string">&quot;terraform plan&quot;</span> to see
any changes that are required <span class="token keyword">for</span> your infrastructure. All Terraform commands
should now work.

If you ever <span class="token builtin class-name">set</span> or change modules or backend configuration <span class="token keyword">for</span> Terraform,
rerun this <span class="token builtin class-name">command</span> to reinitialize your working directory. If you forget, other
commands will detect it and remind you to <span class="token keyword">do</span> so <span class="token keyword">if</span> necessary.
PS C:<span class="token punctuation">\</span>project<span class="token punctuation">\</span>mySpike<span class="token operator">&gt;</span> terraform terraform apply -auto-approve
Terraform has no <span class="token builtin class-name">command</span> named <span class="token string">&quot;terraform&quot;</span><span class="token builtin class-name">.</span>

To see all of Terraform&apos;s top-level commands, run:
  terraform <span class="token parameter variable">-help</span>
</code></pre>
<p>&#x7136;&#x540E;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x9884;&#x89C8;&#x4E00;&#x4E0B;&#x4EE3;&#x7801;&#x5373;&#x5C06;&#x4EA7;&#x751F;&#x7684;&#x53D8;&#x66F4;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">$ data.aws_ami.ubuntu: Reading<span class="token punctuation">..</span>.
data.aws_ami.ubuntu: Read complete after 0s <span class="token punctuation">[</span>id<span class="token operator">=</span>ami-1e749f67<span class="token punctuation">]</span>

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following  
symbols:
  + create

Terraform will perform the following actions:

  <span class="token comment"># aws_eip.example will be created</span>
  + resource <span class="token string">&quot;aws_eip&quot;</span> <span class="token string">&quot;example&quot;</span> <span class="token punctuation">{</span>
      + allocation_id        <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + association_id       <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + carrier_ip           <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + customer_owned_ip    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + domain               <span class="token operator">=</span> <span class="token string">&quot;vpc&quot;</span>
      + <span class="token function">id</span>                   <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + instance             <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + network_border_group <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + network_interface    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + private_dns          <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + private_ip           <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + public_dns           <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + public_ip            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + public_ipv4_pool     <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + tags_all             <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + vpc                  <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
    <span class="token punctuation">}</span>

  <span class="token comment"># aws_eip_association.eip_assoc will be created</span>
  + resource <span class="token string">&quot;aws_eip_association&quot;</span> <span class="token string">&quot;eip_assoc&quot;</span> <span class="token punctuation">{</span>
      + allocation_id        <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + <span class="token function">id</span>                   <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + instance_id          <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + network_interface_id <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + private_ip_address   <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + public_ip            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
    <span class="token punctuation">}</span>

  <span class="token comment"># aws_instance.web will be created</span>
  + resource <span class="token string">&quot;aws_instance&quot;</span> <span class="token string">&quot;web&quot;</span> <span class="token punctuation">{</span>
      + ami                                  <span class="token operator">=</span> <span class="token string">&quot;ami-1e749f67&quot;</span>
      + arn                                  <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + associate_public_ip_address          <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + availability_zone                    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + cpu_core_count                       <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + cpu_threads_per_core                 <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + disable_api_stop                     <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + disable_api_termination              <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + ebs_optimized                        <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + get_password_data                    <span class="token operator">=</span> <span class="token boolean">false</span>
      + host_id                              <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + host_resource_group_arn              <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + iam_instance_profile                 <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + <span class="token function">id</span>                                   <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + instance_initiated_shutdown_behavior <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + instance_lifecycle                   <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + instance_state                       <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + instance_type                        <span class="token operator">=</span> <span class="token string">&quot;t3.micro&quot;</span>
      + ipv6_address_count                   <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + ipv6_addresses                       <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + key_name                             <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + monitoring                           <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + outpost_arn                          <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + password_data                        <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + placement_group                      <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + placement_partition_number           <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + primary_network_interface_id         <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + private_dns                          <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + private_ip                           <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + public_dns                           <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + public_ip                            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + secondary_private_ips                <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + security_groups                      <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + source_dest_check                    <span class="token operator">=</span> <span class="token boolean">true</span>
      + spot_instance_request_id             <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + subnet_id                            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + tags                                 <span class="token operator">=</span> <span class="token punctuation">{</span>
          + <span class="token string">&quot;Name&quot;</span> <span class="token operator">=</span> <span class="token string">&quot;HelloWorld&quot;</span>
        <span class="token punctuation">}</span>
      + tags_all                             <span class="token operator">=</span> <span class="token punctuation">{</span>
          + <span class="token string">&quot;Name&quot;</span> <span class="token operator">=</span> <span class="token string">&quot;HelloWorld&quot;</span>
        <span class="token punctuation">}</span>
      + tenancy                              <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + user_data                            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + user_data_base64                     <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + user_data_replace_on_change          <span class="token operator">=</span> <span class="token boolean">false</span>
      + vpc_security_group_ids               <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
    <span class="token punctuation">}</span>

Plan: <span class="token number">3</span> to add, <span class="token number">0</span> to change, <span class="token number">0</span> to destroy.

Changes to Outputs:
  + instance_id <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
&#x2577;
&#x2502; Warning: AWS account ID not found <span class="token keyword">for</span> provider
&#x2502;
&#x2502;   with provider<span class="token punctuation">[</span><span class="token string">&quot;registry.terraform.io/hashicorp/aws&quot;</span><span class="token punctuation">]</span>,
&#x2502;   on main.tf line <span class="token number">1</span>, <span class="token keyword">in</span> provider <span class="token string">&quot;aws&quot;</span><span class="token builtin class-name">:</span>
&#x2502;    <span class="token number">1</span>: provider <span class="token string">&quot;aws&quot;</span> <span class="token punctuation">{</span>
&#x2502;
&#x2502; See https://registry.terraform.io/providers/hashicorp/aws/latest/docs<span class="token comment">#skip_requesting_account_id for implications.</span>
&#x2575;

&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500; 

Note: You didn<span class="token string">&apos;t use the -out option to save this plan, so Terraform can&apos;</span>t guarantee to take exactly these actions <span class="token keyword">if</span> you run      
<span class="token string">&quot;terraform apply&quot;</span> now.
</code></pre>
<p>&#x8FD9;&#x6BB5;&#x8F93;&#x51FA;&#x544A;&#x8BC9;&#x6211;&#x4EEC;&#xFF0C;&#x4EE3;&#x7801;&#x5373;&#x5C06;&#x521B;&#x5EFA; 3 &#x4E2A;&#x65B0;&#x8D44;&#x6E90;&#xFF0C;&#x4FEE;&#x6539; 0 &#x4E2A;&#x8D44;&#x6E90;&#xFF0C;&#x5220;&#x9664; 0 &#x4E2A;&#x8D44;&#x6E90;&#x3002;&#x8D44;&#x6E90;&#x7684;&#x5C5E;&#x6027;&#x5C11;&#x90E8;&#x5206;&#x662F;&#x6211;&#x4EEC;&#x5728;&#x4EE3;&#x7801;&#x4E2D;&#x76F4;&#x63A5;&#x7ED9;&#x51FA;&#x7684;&#xFF0C;&#x6216;&#x662F;&#x901A;&#x8FC7; <code>data</code> &#x67E5;&#x8BE2;&#x7684;&#xFF0C;&#x6240;&#x4EE5;&#x5728;plan&#x547D;&#x4EE4;&#x7684;&#x7ED3;&#x679C;&#x4E2D;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x5B83;&#x4EEC;&#x7684;&#x503C;&#xFF1B;&#x66F4;&#x591A;&#x7684;&#x5C5E;&#x6027;&#x53EA;&#x6709;&#x5728;&#x8D44;&#x6E90;&#x771F;&#x6B63;&#x88AB;&#x521B;&#x5EFA;&#x4EE5;&#x540E;&#x6211;&#x4EEC;&#x624D;&#x80FD;&#x770B;&#x5230;&#xFF0C;&#x6240;&#x4EE5;&#x4F1A;&#x663E;&#x793A; <code>(known after apply)</code>&#x3002;</p>
<p>&#x7136;&#x540E;&#x6211;&#x4EEC;&#x8FD0;&#x884C;&#x4E00;&#x4E0B;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">$ terraform apply

data.aws_ami.ubuntu: Reading<span class="token punctuation">..</span>.
data.aws_ami.ubuntu: Read complete after 0s <span class="token punctuation">[</span>id<span class="token operator">=</span>ami-1e749f67<span class="token punctuation">]</span>

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following  
symbols:
  + create

Terraform will perform the following actions:

  <span class="token comment"># aws_eip.example will be created</span>
  + resource <span class="token string">&quot;aws_eip&quot;</span> <span class="token string">&quot;example&quot;</span> <span class="token punctuation">{</span>
      + allocation_id        <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + association_id       <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + carrier_ip           <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + customer_owned_ip    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + domain               <span class="token operator">=</span> <span class="token string">&quot;vpc&quot;</span>
      + <span class="token function">id</span>                   <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + instance             <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + network_border_group <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + network_interface    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + private_dns          <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + private_ip           <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + public_dns           <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + public_ip            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + public_ipv4_pool     <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + tags_all             <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + vpc                  <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
    <span class="token punctuation">}</span>

  <span class="token comment"># aws_eip_association.eip_assoc will be created</span>
  + resource <span class="token string">&quot;aws_eip_association&quot;</span> <span class="token string">&quot;eip_assoc&quot;</span> <span class="token punctuation">{</span>
      + allocation_id        <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + <span class="token function">id</span>                   <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + instance_id          <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + network_interface_id <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + private_ip_address   <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + public_ip            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
    <span class="token punctuation">}</span>

  <span class="token comment"># aws_instance.web will be created</span>
  + resource <span class="token string">&quot;aws_instance&quot;</span> <span class="token string">&quot;web&quot;</span> <span class="token punctuation">{</span>
      + ami                                  <span class="token operator">=</span> <span class="token string">&quot;ami-1e749f67&quot;</span>
      + arn                                  <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + associate_public_ip_address          <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + availability_zone                    <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + cpu_core_count                       <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + cpu_threads_per_core                 <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + disable_api_stop                     <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + disable_api_termination              <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + ebs_optimized                        <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + get_password_data                    <span class="token operator">=</span> <span class="token boolean">false</span>
      + host_id                              <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + host_resource_group_arn              <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + iam_instance_profile                 <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + <span class="token function">id</span>                                   <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + instance_initiated_shutdown_behavior <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + instance_lifecycle                   <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + instance_state                       <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + instance_type                        <span class="token operator">=</span> <span class="token string">&quot;t3.micro&quot;</span>
      + ipv6_address_count                   <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + ipv6_addresses                       <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + key_name                             <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + monitoring                           <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + outpost_arn                          <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + password_data                        <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + placement_group                      <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + placement_partition_number           <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + primary_network_interface_id         <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + private_dns                          <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + private_ip                           <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + public_dns                           <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + public_ip                            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + secondary_private_ips                <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + security_groups                      <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + source_dest_check                    <span class="token operator">=</span> <span class="token boolean">true</span>
      + spot_instance_request_id             <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + subnet_id                            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + tags                                 <span class="token operator">=</span> <span class="token punctuation">{</span>
          + <span class="token string">&quot;Name&quot;</span> <span class="token operator">=</span> <span class="token string">&quot;HelloWorld&quot;</span>
        <span class="token punctuation">}</span>
      + tags_all                             <span class="token operator">=</span> <span class="token punctuation">{</span>
          + <span class="token string">&quot;Name&quot;</span> <span class="token operator">=</span> <span class="token string">&quot;HelloWorld&quot;</span>
        <span class="token punctuation">}</span>
      + tenancy                              <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + user_data                            <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + user_data_base64                     <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
      + user_data_replace_on_change          <span class="token operator">=</span> <span class="token boolean">false</span>
      + vpc_security_group_ids               <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
    <span class="token punctuation">}</span>

Plan: <span class="token number">3</span> to add, <span class="token number">0</span> to change, <span class="token number">0</span> to destroy.

Changes to Outputs:
  + instance_id <span class="token operator">=</span> <span class="token punctuation">(</span>known after apply<span class="token punctuation">)</span>
&#x2577;
&#x2502; Warning: AWS account ID not found <span class="token keyword">for</span> provider
&#x2502;
&#x2502;   with provider<span class="token punctuation">[</span><span class="token string">&quot;registry.terraform.io/hashicorp/aws&quot;</span><span class="token punctuation">]</span>,
&#x2502;   on main.tf line <span class="token number">1</span>, <span class="token keyword">in</span> provider <span class="token string">&quot;aws&quot;</span><span class="token builtin class-name">:</span>
&#x2502;    <span class="token number">1</span>: provider <span class="token string">&quot;aws&quot;</span> <span class="token punctuation">{</span>
&#x2502;
&#x2502; See https://registry.terraform.io/providers/hashicorp/aws/latest/docs<span class="token comment">#skip_requesting_account_id for implications.</span>
&#x2575;

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only <span class="token string">&apos;yes&apos;</span> will be accepted to approve.

  Enter a value: <span class="token function">yes</span>
</code></pre>
<p>&#x5F53;&#x6211;&#x4EEC;&#x8FD0;&#x884C; <code>terraform apply</code> &#x65F6;&#xFF0C;Terraform &#x4F1A;&#x9996;&#x5148;&#x91CD;&#x65B0;&#x8BA1;&#x7B97;&#x4E00;&#x4E0B;&#x53D8;&#x66F4;&#x8BA1;&#x5212;&#xFF0C;&#x5E76;&#x4E14;&#x50CF;&#x521A;&#x624D;&#x6267;&#x884C; <code>plan</code> &#x547D;&#x4EE4;&#x90A3;&#x6837;&#x628A;&#x53D8;&#x66F4;&#x8BA1;&#x5212;&#x6253;&#x5370;&#x7ED9;&#x6211;&#x4EEC;&#xFF0C;&#x8981;&#x6C42;&#x6211;&#x4EEC;&#x4EBA;&#x5DE5;&#x786E;&#x8BA4;&#x3002;&#x8BA9;&#x6211;&#x4EEC;&#x8F93;&#x5165; <code>yes</code>&#xFF0C;&#x7136;&#x540E;&#x56DE;&#x8F66;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">aws_eip.example: Creating<span class="token punctuation">..</span>.
aws_instance.web: Creating<span class="token punctuation">..</span>.
aws_eip.example: Creation complete after 0s <span class="token punctuation">[</span>id<span class="token operator">=</span>eipalloc-c71b7984<span class="token punctuation">]</span>
aws_instance.web: Still creating<span class="token punctuation">..</span>. <span class="token punctuation">[</span>10s elapsed<span class="token punctuation">]</span>
aws_instance.web: Creation complete after 10s <span class="token punctuation">[</span>id<span class="token operator">=</span>i-c22230eecf2b8a950<span class="token punctuation">]</span>
aws_eip_association.eip_assoc: Creating<span class="token punctuation">..</span>.
aws_eip_association.eip_assoc: Creation complete after 0s <span class="token punctuation">[</span>id<span class="token operator">=</span>eipassoc-194f62e6<span class="token punctuation">]</span>
&#x2577;
&#x2502; Warning: AWS account ID not found <span class="token keyword">for</span> provider
&#x2502;
&#x2502;   with provider<span class="token punctuation">[</span><span class="token string">&quot;registry.terraform.io/hashicorp/aws&quot;</span><span class="token punctuation">]</span>,
&#x2502;   on main.tf line <span class="token number">1</span>, <span class="token keyword">in</span> provider <span class="token string">&quot;aws&quot;</span><span class="token builtin class-name">:</span>
&#x2502;    <span class="token number">1</span>: provider <span class="token string">&quot;aws&quot;</span> <span class="token punctuation">{</span>
&#x2502;
&#x2502; See https://registry.terraform.io/providers/hashicorp/aws/latest/docs<span class="token comment">#skip_requesting_account_id for implications.</span>
&#x2575;

Apply complete<span class="token operator">!</span> Resources: <span class="token number">3</span> added, <span class="token number">0</span> changed, <span class="token number">0</span> destroyed.

Outputs:

instance_id <span class="token operator">=</span> <span class="token string">&quot;i-c22230eecf2b8a950&quot;</span>
</code></pre>
<p>&#x53EF;&#x4EE5;&#x770B;&#x5230;&#xFF0C;Terraform &#x6210;&#x529F;&#x5730;&#x521B;&#x5EFA;&#x4E86;&#x6211;&#x4EEC;&#x5B9A;&#x4E49;&#x7684;&#x8D44;&#x6E90;&#xFF0C;&#x5E76;&#x4E14;&#x628A;&#x6211;&#x4EEC;&#x5B9A;&#x4E49;&#x7684;&#x8F93;&#x51FA;&#x7ED9;&#x6253;&#x5370;&#x4E86;&#x51FA;&#x6765;&#x3002;</p>
<h2 id="&#x6E05;&#x7406;"><a name="&#x6E05;&#x7406;" class="anchor-navigation-ex-anchor" href="#&#x6E05;&#x7406;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2.1.4. &#x6E05;&#x7406;</h2>
<p>&#x5B8C;&#x6210;&#x8FD9;&#x4E2A;&#x4F53;&#x9A8C;&#x540E;&#xFF0C;&#x4E0D;&#x8981;&#x5FD8;&#x8BB0;&#x6E05;&#x7406;&#x6211;&#x4EEC;&#x7684;&#x4E91;&#x7AEF;&#x8D44;&#x6E90;&#x3002;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8C03;&#x7528; <code>destroy</code> &#x547D;&#x4EE4;&#x6765;&#x8F7B;&#x677E;&#x5B8C;&#x6210;&#x6E05;&#x7406;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">$ terraform destroy
data.aws_ami.ubuntu: Reading<span class="token punctuation">..</span>.
aws_eip.example: Refreshing state<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span>eipalloc-c71b7984<span class="token punctuation">]</span>
data.aws_ami.ubuntu: Read complete after 0s <span class="token punctuation">[</span>id<span class="token operator">=</span>ami-1e749f67<span class="token punctuation">]</span>
aws_instance.web: Refreshing state<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span>i-c22230eecf2b8a950<span class="token punctuation">]</span>
aws_eip_association.eip_assoc: Refreshing state<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span>eipassoc-194f62e6<span class="token punctuation">]</span>

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following  
symbols:
  - destroy

Terraform will perform the following actions:

  <span class="token comment"># aws_eip.example will be destroyed</span>
  - resource <span class="token string">&quot;aws_eip&quot;</span> <span class="token string">&quot;example&quot;</span> <span class="token punctuation">{</span>
      - allocation_id     <span class="token operator">=</span> <span class="token string">&quot;eipalloc-c71b7984&quot;</span> -<span class="token operator">&gt;</span> null
      - association_id    <span class="token operator">=</span> <span class="token string">&quot;eipassoc-194f62e6&quot;</span> -<span class="token operator">&gt;</span> null
      - domain            <span class="token operator">=</span> <span class="token string">&quot;vpc&quot;</span> -<span class="token operator">&gt;</span> null
      - <span class="token function">id</span>                <span class="token operator">=</span> <span class="token string">&quot;eipalloc-c71b7984&quot;</span> -<span class="token operator">&gt;</span> null
      - instance          <span class="token operator">=</span> <span class="token string">&quot;i-c22230eecf2b8a950&quot;</span> -<span class="token operator">&gt;</span> null
      - network_interface <span class="token operator">=</span> <span class="token string">&quot;eni-b689ba2c&quot;</span> -<span class="token operator">&gt;</span> null
      - private_dns       <span class="token operator">=</span> <span class="token string">&quot;ip-10-73-124-108.ec2.internal&quot;</span> -<span class="token operator">&gt;</span> null
      - private_ip        <span class="token operator">=</span> <span class="token string">&quot;10.73.124.108&quot;</span> -<span class="token operator">&gt;</span> null
      - public_dns        <span class="token operator">=</span> <span class="token string">&quot;ec2-127-127-89-71.compute-1.amazonaws.com&quot;</span> -<span class="token operator">&gt;</span> null
      - public_ip         <span class="token operator">=</span> <span class="token string">&quot;127.127.89.71&quot;</span> -<span class="token operator">&gt;</span> null
      - tags              <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token punctuation">}</span> -<span class="token operator">&gt;</span> null
      - tags_all          <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token punctuation">}</span> -<span class="token operator">&gt;</span> null
      - vpc               <span class="token operator">=</span> <span class="token boolean">true</span> -<span class="token operator">&gt;</span> null
    <span class="token punctuation">}</span>

  <span class="token comment"># aws_eip_association.eip_assoc will be destroyed</span>
  - resource <span class="token string">&quot;aws_eip_association&quot;</span> <span class="token string">&quot;eip_assoc&quot;</span> <span class="token punctuation">{</span>
      - allocation_id        <span class="token operator">=</span> <span class="token string">&quot;eipalloc-c71b7984&quot;</span> -<span class="token operator">&gt;</span> null
      - <span class="token function">id</span>                   <span class="token operator">=</span> <span class="token string">&quot;eipassoc-194f62e6&quot;</span> -<span class="token operator">&gt;</span> null
      - instance_id          <span class="token operator">=</span> <span class="token string">&quot;i-c22230eecf2b8a950&quot;</span> -<span class="token operator">&gt;</span> null
      - network_interface_id <span class="token operator">=</span> <span class="token string">&quot;eni-b689ba2c&quot;</span> -<span class="token operator">&gt;</span> null
      - private_ip_address   <span class="token operator">=</span> <span class="token string">&quot;10.73.124.108&quot;</span> -<span class="token operator">&gt;</span> null
      - public_ip            <span class="token operator">=</span> <span class="token string">&quot;127.127.89.71&quot;</span> -<span class="token operator">&gt;</span> null
    <span class="token punctuation">}</span>

  <span class="token comment"># aws_instance.web will be destroyed</span>
  - resource <span class="token string">&quot;aws_instance&quot;</span> <span class="token string">&quot;web&quot;</span> <span class="token punctuation">{</span>
      - ami                                  <span class="token operator">=</span> <span class="token string">&quot;ami-1e749f67&quot;</span> -<span class="token operator">&gt;</span> null
      - arn                                  <span class="token operator">=</span> <span class="token string">&quot;arn:aws:ec2:us-east-1::instance/i-c22230eecf2b8a950&quot;</span> -<span class="token operator">&gt;</span> null
      - associate_public_ip_address          <span class="token operator">=</span> <span class="token boolean">true</span> -<span class="token operator">&gt;</span> null
      - availability_zone                    <span class="token operator">=</span> <span class="token string">&quot;us-east-1a&quot;</span> -<span class="token operator">&gt;</span> null
      - disable_api_stop                     <span class="token operator">=</span> <span class="token boolean">false</span> -<span class="token operator">&gt;</span> null
      - disable_api_termination              <span class="token operator">=</span> <span class="token boolean">false</span> -<span class="token operator">&gt;</span> null
      - ebs_optimized                        <span class="token operator">=</span> <span class="token boolean">false</span> -<span class="token operator">&gt;</span> null
      - get_password_data                    <span class="token operator">=</span> <span class="token boolean">false</span> -<span class="token operator">&gt;</span> null
      - hibernation                          <span class="token operator">=</span> <span class="token boolean">false</span> -<span class="token operator">&gt;</span> null
      - <span class="token function">id</span>                                   <span class="token operator">=</span> <span class="token string">&quot;i-c22230eecf2b8a950&quot;</span> -<span class="token operator">&gt;</span> null
      - instance_initiated_shutdown_behavior <span class="token operator">=</span> <span class="token string">&quot;stop&quot;</span> -<span class="token operator">&gt;</span> null
      - instance_state                       <span class="token operator">=</span> <span class="token string">&quot;running&quot;</span> -<span class="token operator">&gt;</span> null
      - instance_type                        <span class="token operator">=</span> <span class="token string">&quot;t3.micro&quot;</span> -<span class="token operator">&gt;</span> null
      - ipv6_address_count                   <span class="token operator">=</span> <span class="token number">0</span> -<span class="token operator">&gt;</span> null
      - ipv6_addresses                       <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">]</span> -<span class="token operator">&gt;</span> null
      - monitoring                           <span class="token operator">=</span> <span class="token boolean">false</span> -<span class="token operator">&gt;</span> null
      - placement_partition_number           <span class="token operator">=</span> <span class="token number">0</span> -<span class="token operator">&gt;</span> null
      - primary_network_interface_id         <span class="token operator">=</span> <span class="token string">&quot;eni-b689ba2c&quot;</span> -<span class="token operator">&gt;</span> null
      - private_dns                          <span class="token operator">=</span> <span class="token string">&quot;ip-10-73-124-108.ec2.internal&quot;</span> -<span class="token operator">&gt;</span> null
      - private_ip                           <span class="token operator">=</span> <span class="token string">&quot;10.73.124.108&quot;</span> -<span class="token operator">&gt;</span> null
      - public_dns                           <span class="token operator">=</span> <span class="token string">&quot;ec2-127-127-89-71.compute-1.amazonaws.com&quot;</span> -<span class="token operator">&gt;</span> null
      - public_ip                            <span class="token operator">=</span> <span class="token string">&quot;127.127.89.71&quot;</span> -<span class="token operator">&gt;</span> null
      - secondary_private_ips                <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">]</span> -<span class="token operator">&gt;</span> null
      - security_groups                      <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">]</span> -<span class="token operator">&gt;</span> null
      - source_dest_check                    <span class="token operator">=</span> <span class="token boolean">true</span> -<span class="token operator">&gt;</span> null
      - subnet_id                            <span class="token operator">=</span> <span class="token string">&quot;subnet-73eb6c90&quot;</span> -<span class="token operator">&gt;</span> null
      - tags                                 <span class="token operator">=</span> <span class="token punctuation">{</span>
          - <span class="token string">&quot;Name&quot;</span> <span class="token operator">=</span> <span class="token string">&quot;HelloWorld&quot;</span>
        <span class="token punctuation">}</span> -<span class="token operator">&gt;</span> null
      - tags_all                             <span class="token operator">=</span> <span class="token punctuation">{</span>
          - <span class="token string">&quot;Name&quot;</span> <span class="token operator">=</span> <span class="token string">&quot;HelloWorld&quot;</span>
        <span class="token punctuation">}</span> -<span class="token operator">&gt;</span> null
      - tenancy                              <span class="token operator">=</span> <span class="token string">&quot;default&quot;</span> -<span class="token operator">&gt;</span> null
      - user_data_replace_on_change          <span class="token operator">=</span> <span class="token boolean">false</span> -<span class="token operator">&gt;</span> null
      - vpc_security_group_ids               <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">]</span> -<span class="token operator">&gt;</span> null

      - root_block_device <span class="token punctuation">{</span>
          - delete_on_termination <span class="token operator">=</span> <span class="token boolean">true</span> -<span class="token operator">&gt;</span> null
          - device_name           <span class="token operator">=</span> <span class="token string">&quot;/dev/sda1&quot;</span> -<span class="token operator">&gt;</span> null
          - encrypted             <span class="token operator">=</span> <span class="token boolean">false</span> -<span class="token operator">&gt;</span> null
          - iops                  <span class="token operator">=</span> <span class="token number">0</span> -<span class="token operator">&gt;</span> null
          - tags                  <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token punctuation">}</span> -<span class="token operator">&gt;</span> null
          - throughput            <span class="token operator">=</span> <span class="token number">0</span> -<span class="token operator">&gt;</span> null
          - volume_id             <span class="token operator">=</span> <span class="token string">&quot;vol-b56e5dc7&quot;</span> -<span class="token operator">&gt;</span> null
          - volume_size           <span class="token operator">=</span> <span class="token number">8</span> -<span class="token operator">&gt;</span> null
          - volume_type           <span class="token operator">=</span> <span class="token string">&quot;gp2&quot;</span> -<span class="token operator">&gt;</span> null
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>

Plan: <span class="token number">0</span> to add, <span class="token number">0</span> to change, <span class="token number">3</span> to destroy.

Changes to Outputs:
  - instance_id <span class="token operator">=</span> <span class="token string">&quot;i-c22230eecf2b8a950&quot;</span> -<span class="token operator">&gt;</span> null
&#x2577;
&#x2502; Warning: AWS account ID not found <span class="token keyword">for</span> provider
&#x2502;
&#x2502;   with provider<span class="token punctuation">[</span><span class="token string">&quot;registry.terraform.io/hashicorp/aws&quot;</span><span class="token punctuation">]</span>,
&#x2502;   on main.tf line <span class="token number">1</span>, <span class="token keyword">in</span> provider <span class="token string">&quot;aws&quot;</span><span class="token builtin class-name">:</span>
&#x2502;    <span class="token number">1</span>: provider <span class="token string">&quot;aws&quot;</span> <span class="token punctuation">{</span>
&#x2502;
&#x2502; See https://registry.terraform.io/providers/hashicorp/aws/latest/docs<span class="token comment">#skip_requesting_account_id for implications.</span>
&#x2575;

Do you really want to destroy all resources?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only <span class="token string">&apos;yes&apos;</span> will be accepted to confirm.

  Enter a value: <span class="token function">yes</span>
</code></pre>
<p>&#x53EF;&#x4EE5;&#x770B;&#x5230;&#xFF0C;Terraform &#x5217;&#x51FA;&#x4E86;&#x5B83;&#x5373;&#x5C06;&#x6E05;&#x7406;&#x7684;&#x8D44;&#x6E90;&#x4FE1;&#x606F;&#xFF0C;&#x5E76;&#x4E14;&#x8981;&#x6C42;&#x6211;&#x4EEC;&#x4EBA;&#x5DE5;&#x786E;&#x8BA4;&#x540C;&#x610F;&#x7EE7;&#x7EED;&#x6267;&#x884C;&#x6E05;&#x7406;&#x64CD;&#x4F5C;&#x3002;&#x6211;&#x4EEC;&#x8F93;&#x5165; <code>yes</code>&#xFF0C;&#x7136;&#x540E;&#x56DE;&#x8F66;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">aws_eip_association.eip_assoc: Destroying<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span>eipassoc-194f62e6<span class="token punctuation">]</span>
aws_eip_association.eip_assoc: Destruction complete after 0s
aws_eip.example: Destroying<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span>eipalloc-c71b7984<span class="token punctuation">]</span>
aws_instance.web: Destroying<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span>i-c22230eecf2b8a950<span class="token punctuation">]</span>
aws_eip.example: Destruction complete after 0s
aws_instance.web: Still destroying<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span>i-c22230eecf2b8a950, 10s elapsed<span class="token punctuation">]</span>
aws_instance.web: Destruction complete after 10s

Destroy complete<span class="token operator">!</span> Resources: <span class="token number">3</span> destroyed.
</code></pre>
<p>&#x5F88;&#x5FEB;&#x7684;&#xFF0C;&#x521A;&#x624D;&#x521B;&#x5EFA;&#x7684;&#x8D44;&#x6E90;&#x5C31;&#x5168;&#x90E8;&#x88AB;&#x5220;&#x9664;&#x4E86;&#x3002;(&#x5728;&#x672C;&#x4F8B;&#x4E2D;&#x56E0;&#x4E3A;&#x6211;&#x4EEC;&#x4F7F;&#x7528;&#x4E86; LocalStack&#xFF0C;&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x5E76;&#x6CA1;&#x6709;&#x771F;&#x7684;&#x521B;&#x5EFA; AWS &#x8D44;&#x6E90;&#xFF0C;&#x6240;&#x4EE5;&#x4E0D;&#x6267;&#x884C; <code>destroy</code> &#x4E5F;&#x6CA1;&#x4EC0;&#x4E48;&#x95EE;&#x9898;&#xFF0C;&#x4F46;&#x662F;&#x5728;&#x8BD5;&#x9A8C;&#x540E;&#x6E05;&#x7406;&#x5B9E;&#x9A8C;&#x8D44;&#x6E90;&#x662F;&#x4E00;&#x4E2A;&#x5F88;&#x597D;&#x7684;&#x4E60;&#x60EF;)</p>
<p>Terraform &#x4E0E;&#x4EE5;&#x5F80;&#x8BF8;&#x5982; Ansible &#x7B49;&#x914D;&#x7F6E;&#x7BA1;&#x7406;&#x5DE5;&#x5177;&#x6BD4;&#x8F83;&#x5927;&#x7684;&#x4E0D;&#x540C;&#x5728;&#x4E8E;&#xFF0C;&#x5B83;&#x662F;&#x6839;&#x636E;&#x4EE3;&#x7801;&#x8BA1;&#x7B97;&#x51FA;&#x7684;&#x76EE;&#x6807;&#x72B6;&#x6001;&#x4E0E;&#x5F53;&#x524D;&#x72B6;&#x6001;&#x7684;&#x5DEE;&#x5F02;&#x6765;&#x8BA1;&#x7B97;&#x53D8;&#x66F4;&#x8BA1;&#x5212;&#x7684;&#xFF0C;&#x6709;&#x5174;&#x8DA3;&#x7684;&#x8BFB;&#x8005;&#x53EF;&#x4EE5;&#x5728;&#x6267;&#x884C; <code>terraform apply</code> &#x4EE5;&#x540E;&#xFF0C;&#x76F4;&#x63A5;&#x518D;&#x6267;&#x884C;&#x4E00;&#x6B21; <code>terraform apply</code>&#xFF0C;&#x770B;&#x770B;&#x4F1A;&#x53D1;&#x751F;&#x4EC0;&#x4E48;&#xFF0C;&#x5C31;&#x80FD;&#x660E;&#x767D;&#x4ED6;&#x4EEC;&#x4E4B;&#x95F4;&#x7684;&#x5DEE;&#x5F02;&#x3002;</p>
<p>&#x5B9E;&#x9645;&#x4E0A;&#x8FD9;&#x6BB5;&#x4EE3;&#x7801;&#x5728; <code>apply</code> &#x4EE5;&#x540E;&#xFF0C;&#x76F4;&#x63A5;&#x518D;&#x6B21; <code>apply</code>&#xFF0C;&#x5F97;&#x5230;&#x7684;&#x8BA1;&#x5212;&#x4F1A;&#x662F;&#x4EC0;&#x4E48;&#x4E5F;&#x4E0D;&#x505A;&#xFF1A;</p>
<pre class="language-"><code class="lang-shell">$ terraform plan

data.aws_ami.ubuntu: Reading<span class="token punctuation">..</span>.
aws_eip.example: Refreshing state<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span>eipalloc-c12bcca1<span class="token punctuation">]</span>
data.aws_ami.ubuntu: Read complete after 0s <span class="token punctuation">[</span>id<span class="token operator">=</span>ami-1e749f67<span class="token punctuation">]</span>
aws_instance.web: Refreshing state<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span>i-0159574cc2f7986ad<span class="token punctuation">]</span>
aws_eip_association.eip_assoc: Refreshing state<span class="token punctuation">..</span>. <span class="token punctuation">[</span>id<span class="token operator">=</span>eipassoc-7f849867<span class="token punctuation">]</span>

No changes. Your infrastructure matches the configuration.
</code></pre>
<p>&#x56E0;&#x4E3A;&#x5F53;&#x524D;&#x4E91;&#x7AEF;&#x7684;&#x8D44;&#x6E90;&#x72B6;&#x6001;&#x5DF2;&#x7ECF;&#x5B8C;&#x5168;&#x7B26;&#x5408;&#x4EE3;&#x7801;&#x6240;&#x63CF;&#x8FF0;&#x7684;&#x671F;&#x671B;&#x72B6;&#x6001;&#x4E86;&#xFF0C;&#x6240;&#x4EE5; Terraform &#x4EC0;&#x4E48;&#x4E5F;&#x4E0D;&#x4F1A;&#x505A;&#x3002;&#x597D;&#x4E86;&#xFF0C;&#x8FD9;&#x5C31;&#x662F;&#x6211;&#x4EEC;&#x5BF9; Terraform &#x7684;&#x4E00;&#x4E2A;&#x521D;&#x6B65;&#x4F53;&#x9A8C;&#x3002;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="./" class="navigation navigation-prev navigation-unique" aria-label="Previous page: Introduction">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Terraform 初步体验","level":"1.2","depth":1,"next":{"title":"Terraform基础概念","level":"1.3","depth":1,"ref":"","articles":[{"title":"Provider","level":"1.3.1","depth":2,"path":"2.1.Terraform基础概念——Provider.md","ref":"./2.1.Terraform基础概念——Provider.md","articles":[]},{"title":"状态管理","level":"1.3.2","depth":2,"path":"2.2.Terraform基础概念——状态管理.md","ref":"./2.2.Terraform基础概念——状态管理.md","articles":[]}]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-highlight","prism","prism-themes","fontsettings","sharing","-lunr","-search","search-pro","livereload","image-captions","sitemap-general","anchor-navigation-ex"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{"css":["prism-themes/themes/prism-vsc-dark-plus.css"],"lang":{"shell":"bash","cmd":"bash"}},"livereload":{},"search-pro":{},"sitemap-general":{"prefix":"https://lonegunmanb.github.io/introduction-terraform/"},"fontsettings":{"family":"sans","size":2,"theme":"white"},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":true},"prism-themes":{},"sharing":{"all":["facebook","google","twitter","weibo","instapaper"],"facebook":true,"google":false,"instapaper":false,"twitter":true,"vk":false,"weibo":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":true},"image-captions":{"caption":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","variable_name":"_pictures"}},"theme":"default","author":"大可不加冰","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{"_pictures":[{"backlink":"index.html#fig1.1.1","level":"1.1","list_caption":"Figure: Nomad、Consul、Vault、Terraform 组成的 HashiStack","alt":"Nomad、Consul、Vault、Terraform 组成的 HashiStack","nro":1,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/2020-11-13/1605243540985-image.png","index":1,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"Nomad、Consul、Vault、Terraform 组成的 HashiStack","attributes":{},"skip":false,"key":"1.1.1"},{"backlink":"index.html#fig1.1.2","level":"1.1","list_caption":"Figure: Terraform 著名教材《Terraform Up & Running》，建议直接阅读第二版","alt":"Terraform 著名教材《Terraform Up & Running》，建议直接阅读第二版","nro":2,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/2020-12-23/1608689176373-image.png","index":2,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"Terraform 著名教材《Terraform Up & Running》，建议直接阅读第二版","attributes":{},"skip":false,"key":"1.1.2"},{"backlink":"./2.1.Terraform基础概念——Provider.html#fig1.3.1.1","level":"1.3.1","list_caption":"Figure: Terraform通过RPC调用插件，插件代码通过调用SDK操作远程资源","alt":"Terraform通过RPC调用插件，插件代码通过调用SDK操作远程资源","nro":3,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/2020-11-16/1605496195438-image.png","index":1,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"Terraform通过RPC调用插件，插件代码通过调用SDK操作远程资源","attributes":{},"skip":false,"key":"1.3.1.1"},{"backlink":"./2.1.Terraform基础概念——Provider.html#fig1.3.1.2","level":"1.3.1","list_caption":"Figure: registry.terraform.io上的插件页面","alt":"registry.terraform.io上的插件页面","nro":4,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/2020-11-19/1605799350775-image.png","index":2,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"registry.terraform.io上的插件页面","attributes":{},"skip":false,"key":"1.3.1.2"},{"backlink":"./2.1.Terraform基础概念——Provider.html#fig1.3.1.3","level":"1.3.1","list_caption":"Figure: registry.terraform.io的搜索页面","alt":"registry.terraform.io的搜索页面","nro":5,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/2020-11-16/1605498907942-image.png","index":3,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"registry.terraform.io的搜索页面","attributes":{},"skip":false,"key":"1.3.1.3"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.1","level":"1.3.2","list_caption":"Figure: Consul的GUI界面","alt":"Consul的GUI界面","nro":6,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240220224455.png","index":1,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"Consul的GUI界面","attributes":{},"skip":false,"key":"1.3.2.1"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.2","level":"1.3.2","list_caption":"Figure: Consul 中可以看到名为 `localstack-aws` 的键","alt":"Consul 中可以看到名为 `localstack-aws` 的键","nro":7,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240220230042.png","index":2,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"Consul 中可以看到名为 `localstack-aws` 的键","attributes":{},"skip":false,"key":"1.3.2.2"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.3","level":"1.3.2","list_caption":"Figure: 键的内容","alt":"键的内容","nro":8,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240220230136.png","index":3,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"键的内容","attributes":{},"skip":false,"key":"1.3.2.3"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.4","level":"1.3.2","list_caption":"Figure: 键依然存在","alt":"键依然存在","nro":9,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240220230312.png","index":4,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"键依然存在","attributes":{},"skip":false,"key":"1.3.2.4"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.5","level":"1.3.2","list_caption":"Figure: 内容已被清空","alt":"内容已被清空","nro":10,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240220230350.png","index":5,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"内容已被清空","attributes":{},"skip":false,"key":"1.3.2.5"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.6","level":"1.3.2","list_caption":"Figure: 多了一个同名的文件夹","alt":"多了一个同名的文件夹","nro":11,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240225100309.png","index":6,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"多了一个同名的文件夹","attributes":{},"skip":false,"key":"1.3.2.6"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.7","level":"1.3.2","list_caption":"Figure: localstack-aws 文件夹内部","alt":"localstack-aws 文件夹内部","nro":12,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240225100354.png","index":7,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"localstack-aws 文件夹内部","attributes":{},"skip":false,"key":"1.3.2.7"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.8","level":"1.3.2","list_caption":"Figure: `.lock` 内容","alt":"`.lock` 内容","nro":13,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240225180803.png","index":8,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"`.lock` 内容","attributes":{},"skip":false,"key":"1.3.2.8"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.9","level":"1.3.2","list_caption":"Figure: `.lockinfo` 内容","alt":"`.lockinfo` 内容","nro":14,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240225180852.png","index":9,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"`.lockinfo` 内容","attributes":{},"skip":false,"key":"1.3.2.9"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.10","level":"1.3.2","list_caption":"Figure: 重新访问Consul","alt":"重新访问Consul","nro":15,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240225101100.png","index":10,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"重新访问Consul","attributes":{},"skip":false,"key":"1.3.2.10"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.11","level":"1.3.2","list_caption":"Figure: 将代码复制到不同的文件夹中保存","alt":"将代码复制到不同的文件夹中保存","nro":16,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/2020-11-17/1605571444613-image.png","index":11,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"将代码复制到不同的文件夹中保存","attributes":{},"skip":false,"key":"1.3.2.11"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.12","level":"1.3.2","list_caption":"Figure: 重新访问 Consul，目前有一个键","alt":"重新访问 Consul，目前有一个键","nro":17,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240225174932.png","index":12,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"重新访问 Consul，目前有一个键","attributes":{},"skip":false,"key":"1.3.2.12"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.13","level":"1.3.2","list_caption":"Figure: Consul 中多了一个 `localstack-aws-env:feature1`","alt":"Consul 中多了一个 `localstack-aws-env:feature1`","nro":18,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240225175538.png","index":13,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"Consul 中多了一个 `localstack-aws-env:feature1`","attributes":{},"skip":false,"key":"1.3.2.13"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.14","level":"1.3.2","list_caption":"Figure: 此时 `localstack-aws-env:feature1` 的内容","alt":"此时 `localstack-aws-env:feature1` 的内容","nro":19,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240225175806.png","index":14,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"此时 `localstack-aws-env:feature1` 的内容","attributes":{},"skip":false,"key":"1.3.2.14"},{"backlink":"./2.2.Terraform基础概念——状态管理.html#fig1.3.2.15","level":"1.3.2","list_caption":"Figure: `localstack-aws-env:feature1` 被删除了","alt":"`localstack-aws-env:feature1` 被删除了","nro":20,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/20240225180126.png","index":15,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"`localstack-aws-env:feature1` 被删除了","attributes":{},"skip":false,"key":"1.3.2.15"},{"backlink":"./5.10.graph.html#fig1.6.10.1","level":"1.6.10","list_caption":"Figure: 生成的依赖图","alt":"生成的依赖图","nro":21,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/2020-11-25/1606272727693-image.png","index":1,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"生成的依赖图","attributes":{},"skip":false,"key":"1.6.10.1"},{"backlink":"8.CloudPosse最佳实践.html#fig1.9.1","level":"1.9","list_caption":"Figure: Terraform 输出值的命名要对称","alt":"Terraform 输出值的命名要对称","nro":22,"url":"https://raw.githubusercontent.com/lonegunmanb/introduction-to-terraform-pic/master/2021-11-28/1638086002974-image.png","index":1,"caption_template":"图 _PAGE_LEVEL_/_PAGE_IMAGE_NUMBER_ - _CAPTION_","label":"Terraform 输出值的命名要对称","attributes":{},"skip":false,"key":"1.9.1"}]},"title":"《Terraform入门教程》","gitbook":"*"},"file":{"path":"1.Terraform初步体验.md","mtime":"2024-05-25T00:11:31.199Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2024-06-24T12:39:39.308Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    

    </body>
</html>

